package leetcode.code0058;

public class Solution extends Solution58 {

	@Override
	public int lengthOfLastWord(String s) {
		char[] chars = s.toCharArray();
		int ans = 0;
		for (int i = chars.length - 1; i >= 0; i--) {
			if (chars[i] != ' ') {
				ans++;
			} else if (ans > 0) {
				break;
			}
		}
		return ans;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
	}

}
